package ModelLayer;
public class Product
{
    private int barcode;
    private String name;
    private double sellingPrice;
    private double leasingPrice;
    private double priceForDiscount;
    private int amountForDiscount;
    private int amount;
    private int minAmount;
    private int maxAmount;
    private int orderAmount;
    private int contractorId;
    private int locationCode;
    private int sold;
    private int leased;
    private int ordered;

    public Product(int barcode, String name, double sellingPrice, double leasingPrice, double priceForDiscount, int amountForDiscount, int amount,
    int minAmount, int maxAmount, int contractorId, int locationCode){
        this.barcode = barcode;
        this.name = name;
        this.sellingPrice = sellingPrice;
        this.leasingPrice = leasingPrice;
        this.priceForDiscount = priceForDiscount;
        this.amountForDiscount = amountForDiscount;
        this.amount = amount;
        this.minAmount = minAmount;
        this.maxAmount = maxAmount;
        this.contractorId = contractorId;
        this.locationCode = locationCode;
        this.sold = 0;
        this.leased = 0;
        this.ordered = 0;
    }

    public void recalculateAmount(int change) {
        this.amount -= change; 
    }

    public void recalculateOrderAmount(int amount){
        orderAmount = orderAmount + amount;
    }

    //     public boolean canOrderMore(){
    //         if(orderAmount <(maxAmount - amount))
    //             return true;
    //         else
    //             return false;
    //     }

    public int getBarcode() {
        return barcode;
    }

    public void setBarcode(int barcode) {
        this.barcode = barcode;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getLocationCode() {
        return locationCode;
    }

    public void setLocationCode(int locationCode) {
        this.locationCode = locationCode;
    }

    public String getLocation(){
        String location = "";
        if(locationCode == 1)
            location = "Timber Department";
        else if(locationCode == 2)
            location = "DIY Department";
        return location;
    }

    public double getSellingPrice() {
        return sellingPrice;
    }

    public void setSellingPrice(double sellingPrice) {
        this.sellingPrice = sellingPrice;
    }

    public double getLeasingPrice() {
        return leasingPrice;
    }

    public void setLeasingPrice(double leasingPrice) {
        this.leasingPrice = leasingPrice;
    }

    public double getPriceForDiscount() {
        return priceForDiscount;
    }

    public void setPriceForDiscount(double priceForDiscount) {
        this.priceForDiscount = priceForDiscount;
    }

    public int getAmount() {
        return amount;
    }

    public void setAmount(int amount) {
        this.amount = amount;
    }

    public int getOrderAmount() {
        return orderAmount;
    }

    public void setOrderAmount(int orderAmount) {
        this.orderAmount = orderAmount;
    }

    public int getMinAmount() {
        return minAmount;
    }

    public void setMinAmount(int minAmount) {
        this.minAmount = minAmount;
    }

    public int getMaxAmount() {
        return maxAmount;
    }

    public void setMaxAmount(int maxAmount) {
        this.maxAmount = maxAmount;
    }

    public int getAmountForDiscount() {
        return amountForDiscount;
    }

    public void setAmountForDiscount(int amountForDiscount) {
        this.amountForDiscount = amountForDiscount;
    }

    public int getContractorId() {
        return contractorId;
    }

    public void setContractorId(int contractorId) {
        this.contractorId = contractorId;
    }
    
    public int getSold()
    {
        return sold;
    }
    
    public void setSold(int amount)
    {
        sold += amount;
    }
    
    public int getLeased()
    {
        return leased;
    }
    
    public void setLeased(int amount)
    {
        leased += amount;
    }
    
    public int getOrdered()
    {
        return ordered;
    }
    
    public void setOrdered(int amount)
    {
        ordered += amount;
    }
}
